<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="./js/react.development.js"></script>
  <script src="./js/react-dom.development.js"></script>
  <script src="./js/babel.min.js"></script>
</head>
<body>
  <div id="app"></div>

  <input type="text" id="input">

  <script>
    document.getElementById('input').onblur = (e) => {
      console.log(e)
    }
  </script>

  <script type="text/babel">

    function handleClick(event) {
      console.log(event, event.pageX, event.pageY)
      alert(event.target.innerHTML)
    }

    const handleChange = (e) => {
      console.log(e)
      // alert(e.target.value)
    }

    const handleBlur= (e) => {
      console.log(e)
    }

    function handleClick2(e) {
      // 阻止事件的默认行为
      e.preventDefault()
    }

    const vDom = (
      <div>
        <button onClick={handleClick}>点击我</button>
        <br/>
        <input type="text" onChange={handleChange} onBlur={handleBlur}/>
        <br/>
        <br/>
        <a href="http://www.baidu.com" onClick={handleClick2}>去百度</a>

      </div>
    )

    // 渲染虚拟DOM
    ReactDOM.render(vDom, document.getElementById('app'))
  </script>
</body>
</html>